package com.ayu.shortlink.project.dao.mapper;

import com.ayu.shortlink.project.dao.entiry.LinkStatsTodayDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

public interface LinkStatsTodayMapper extends BaseMapper<LinkStatsTodayDO> {

    /**
     * 短链接每日访问数据统计
     */
    @Insert("INSERT INTO t_link_stats_today (full_short_url,date,today_pv,today_uv,today_uip,create_time,update_time,del_flag)" +
            "VALUES (#{param.fullShortUrl},#{param.date},#{param.todayPv},#{param.todayUv},#{param.todayUip},NOW(),NOW(),0)"+
            "ON DUPLICATE KEY UPDATE today_pv = today_pv + #{param.todayPv},today_uv = today_uv + #{param.todayUv},today_uip = today_uip + #{param.todayUip};")
    void shortLinkTodayStats(@Param("param") LinkStatsTodayDO linkStatsTodayDO);

//    @Select("SELECT * FROM t_link_stats_today WHERE id = #{param}")
//    LinkStatsTodayDO selectTest(@Param("param") Integer id);
}
